const app = getApp()
const requests = require("../../../../utils/request")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userId:'',
    place:'',
    category:'',
    addrNo:'',
    orderId:'',
    time:'',
    categoryImg:''
  },

  gotoOrders()
  {
    wx.switchTab({
      url: '../../../order/index',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad:async function (options) {
        //通过orderId查询订单信息    console.log(options.orderId)
    let res= await requests.deliverorderInterface(null,null,null,null,options.orderId,null,null,null,null,null,'getByOrderId')
    console.log(res.data.data.value)
    const {addrNo,category,orderId,place,time,userId} = res.data.data.value
    let categoryImg
    switch(category)
    {
      case '可回收物':
        categoryImg='/imgs/lajifenlei/1.png'
        break
      case '厨余垃圾':
        categoryImg='/imgs/lajifenlei/2.png'
        break
      case '其他垃圾':
        categoryImg='/imgs/lajifenlei/3.png'
        break
      case '有害垃圾':
        categoryImg='/imgs/lajifenlei/4.png'
        break
    }
    this.setData({
      userId,
      place,
      category,
      addrNo,
      orderId,
      time,
      categoryImg
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})